# -*- coding: utf-8 -*-
# @Time    : 2021/1/5 上午9:36
# @Author  : tgy

class Solution:
    def largeGroupPositions(self, s):
        ...
        results = []
        if not s or len(s) < 3:
            return results

        chars = list(s)
        chars_len = len(chars)
        tmp_len = 1
        for i in range(chars_len):
            if i == (chars_len - 1) or \
                    chars[i] != chars[i+1]:

                if tmp_len >= 3:
                    results.append([i - tmp_len + 1, i])
                tmp_len = 1
            else:
                tmp_len += 1

        return results


if __name__ == '__main__':
    ...
    solution = Solution()
    results = solution.largeGroupPositions('abcdddeeeeaabbbcd')
    print(results)
